<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>${title}</title>
        <link href="templatemo_style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="templatemo_container">
            <div id="templatemo_menu">
                <ul>
                    <li><a href="home.jsp" <c:if test="${title=='Home'}" > class="current" </c:if>>Home</a></li>
                    <li><a href="Search.jsp" <c:if test="${title=='Search'}" > class="current" </c:if>>Search</a></li> 
                    <c:if test="${empty user}">
                        <li><a href="Login.jsp" <c:if test="${title=='Login'}" > class="current" </c:if>>Login</a></li>  
                        <li><a href="Register.jsp" <c:if test="${title=='Register'}" > class="current" </c:if>>Register</a></li>
                    </c:if>
                    <c:if test="${user.type == 'admin'}" >
                        <li><a href="Books.jsp" <c:if test="${title=='Books'}" > class="current" </c:if>>Books</a></li> 
                        <li><a href="Customers.jsp" <c:if test="${title=='Customers'}" > class="current" </c:if>>Customers</a></li>
                    </c:if>
                    <li><a href="Company.jsp" <c:if test="${title=='Company'}" > class="current" </c:if>>Company</a></li> 
                    <li><a href="Contact.jsp" <c:if test="${title=='Contact'}" > class="current" </c:if>>Contact</a></li>
                </ul>

                <c:if test="${not empty user}"><div align="right" style="margin-right:20px">
                        <b> welcome <a href="Profile.jsp">${user.firstName}</a></b></div></c:if>
                </div> <!-- end of menu -->

                <div id="templatemo_header">
                    <div id="templatemo_special_offers">
                        <p>
                            <span>10%</span> discounts for
                            purchase in the next THREE months
                        </p>
                    <%--	<a href="subpage.html" style="margin-left: 50px;">Read more...</a> --%>
                </div>


                <div id="templatemo_new_books">
                    <ul>
                        <c:forEach items="${newbooks}" var="book">
                            <li><a href="book.jsp?isbn=${book.isbn}">${book.title}</a></li> 
                        </c:forEach>
                    </ul>
                    <%--	<a href="subpage.html" style="margin-left: 50px;">Read more...</a> --%>
                </div>
            </div> <!-- end of header -->
            <div id="templatemo_content">

                <div id="templatemo_content_left">
                    <div class="templatemo_content_left_section">
                        <h1>Categories</h1>
                        <ul>
                            <c:forEach items="${categories}" var="cat">
                                <li><a href="home.jsp?cat=${cat}">${cat}</a></li> 
                            </c:forEach>
                        </ul>
                    </div>
                    <div class="templatemo_content_left_section">
                        <h1>Best Customers</h1>
                        <ul>
                            <!-- For Loop on this with diff attrs -->

                            <c:choose>
                                <c:when test="${user.type == 'admin'}">
                                    <c:forEach items="${customers}" var="cust">
                                        <li><a href="Profile.jsp?id=${cust.id}">${cust.firstName} ${cust.lastName}</a></li> 
                                    </c:forEach>
                                </c:when>
                                <c:otherwise>
                                    <c:forEach items="${customers}" var="cust">
                                        <li style="color:#969547"> ${cust.firstName} ${cust.lastName}</li> 
                                    </c:forEach>
                                </c:otherwise>
                            </c:choose>

                        </ul>
                    </div>
                </div> <!-- end of content left -->
